<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台用户封停</title>
    <script src="/jquery/jquery-3.2.1.min.js"></script>
    <script src="/layui/layui.js"></script>
    <link rel="stylesheet" href="/layui/css/layui.css"/>
    <style>
        form > div{
            width:95%;
            margin-top: 4%;
        }
        .right{
            position: absolute;
            bottom: 10%;
            right: 5%;
        }
    </style>
</head>
<body>
    <form class="layui-form" action="">
        <input name="id" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label">用户账号：</label>
            <div class="layui-input-block">
                <input type="text" name="account" required  lay-verify="required" disabled="disabled" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">封停天数：</label>
            <div class="layui-input-block">
                <select name="days" lay-filter="filter" lay-verify="filter">
                    <option value="7">7天</option>
                    <option value="15">15天</option>
                    <option value="20">20天</option>
                    <option value="30">30天</option>
                    <option value="36500">永久</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">封停原因：</label>
            <div class="layui-input-block">
                <textarea id="deptDescirbe" name="reason" placeholder="请输入内容" class="layui-textarea"></textarea>
            </div>
        </div>
    </form>
    <div class="right">
        <a class="layui-btn layui-btn-xs layui-btn-normal" href="javascript:sub();">
            确定
        </a>
        <a class="layui-btn layui-btn-xs layui-btn-primary" href="javascript:;cancel()">
            取消
        </a>
    </div>
</body>
    <script>
        var $;
        var element;
        var form;
        var table;
        var laydate;
        var status;
        var layer;
        layui.use(['jquery','element','form','table','laydate','layer'],function () {
            $ = layui.$;
            element = layui.element;
            form = layui.form;
            table = layui.table;
            laydate = layui.laydate;
            layer = layui.layer;
        });
        function sub() {
            var userId = $('input[name = id]').val();
            var reason = $('textarea[name = reason]').val();
            var days = $('select[name = days]').val();
            $.ajax({
                url:'/Department/updateUserType',
                data:{'userId':userId,'reason':reason,'days':days},
                dataType:'json',
                success:function (data) {
                    if(data.data){
                        parent.layer.msg("封停成功");
                    }else{
                        parent.layer.msg("封停失败");
                    }
                }
            });
            var layer = parent.layer;
            layer.close(layer.index);
        }

        function cancel() {
            var layer = parent.layer;
            layer.close(layer.index);
        }
    </script>
</html>